package com.tangyee.home_knowledge.bean;

import android.annotation.SuppressLint;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 我在分类展开看详情页的时候，有将这个 bean 传到下一个活动，因此要序列化
 * 在这个类中有一个内部类，也要序列化，否则包异常
 * @author: yu huawen
 * @date: 2019/2/1 16:37
 */
public class KnowledgeSortExpandItem implements Serializable {

    private KnowledgeDetail knowledge;
    private String image;

    public KnowledgeDetail getKnowledge() {
        return knowledge;
    }

    public void setKnowledge(KnowledgeDetail knowledge) {
        this.knowledge = knowledge;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public class KnowledgeDetail implements Serializable{
        private String ArticleContent;
        private int AuthorID;
        // 目录子级
        private int Category;
        private int ID;
        private String ModiDate;
        private String ReleaseDate;
        private String Summary;
        // 目录父级
        private int SupCategory;
        private String Title;

        public String getArticleContent() {
            return ArticleContent;
        }

        public void setArticleContent(String articleContent) {
            ArticleContent = articleContent;
        }

        public int getAuthorID() {
            return AuthorID;
        }

        public void setAuthorID(int authorID) {
            AuthorID = authorID;
        }

        public int getCategory() {
            return Category;
        }

        public void setCategory(int category) {
            Category = category;
        }

        public int getID() {
            return ID;
        }

        public void setID(int ID) {
            this.ID = ID;
        }

        public String getModiDate() {
            return ModiDate;
        }

        public void setModiDate(String modiDate) {
            ModiDate = modiDate;
        }

        public String getReleaseDate() {
            return ReleaseDate;
        }

        public void setReleaseDate(String releaseDate) {
            ReleaseDate = releaseDate;
        }

        public String getSummary() {
            return Summary;
        }

        public void setSummary(String summary) {
            Summary = summary;
        }

        public int getSupCategory() {
            return SupCategory;
        }

        public void setSupCategory(int supCategory) {
            SupCategory = supCategory;
        }

        public String getTitle() {
            return Title;
        }

        public void setTitle(String title) {
            Title = title;
        }

        public String getRealYearMonthDate(){
            String str1 = getReleaseDate().substring(getReleaseDate().indexOf("(") + 1, getReleaseDate().length());
            String str2 = str1.substring(0, str1.indexOf(")"));
            Long time = Long.valueOf(str2);
            Date date = new Date(time);
            @SuppressLint("SimpleDateFormat") SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String s = sdf.format(date);
            return s;
        }
    }
}
